﻿using System.Collections.Generic;
using System.Runtime.Serialization;
using IdeaBlade.EntityModel;
using IdeaBlade.Validation;

namespace CoProjectDF.Models.Login
{

    /// <summary>
    /// Returned by the RegistrationServices.CreateUser call.
    /// </summary>
    [DataContract]
    public class CreateUserResult : IKnownType
    {

        public static CreateUserResult Success = new CreateUserResult(CreateUserStatus.Success);

        public CreateUserResult(CreateUserStatus status)
        {
            Status = status;
        }

        public CreateUserResult(List<VerifierResult> errors)
        {
            Status = CreateUserStatus.ValidationFailed;
            ValidationErrors = errors;
        }

        [DataMember]
        public CreateUserStatus Status { get; internal set; }

        [DataMember]
        public List<VerifierResult> ValidationErrors { get; internal set; }

    }

    /// <summary>
    /// An enumeration of the values that can be returned when registering a user.  
    /// </summary>
    public enum CreateUserStatus
    {
        Success = 0,
        InvalidUserName = 1,
        InvalidPassword = 2,
        InvalidQuestion = 3,
        InvalidAnswer = 4,
        InvalidEmail = 5,
        DuplicateUserName = 6,
        DuplicateEmail = 7,
        Failure = 8,
        ValidationFailed = 9,
    }
}

